
package com.dyzx.hbb.common.utils;

import java.security.SecureRandom;
import java.util.Base64;

public class SimpleJwtKeyGenerator {
    public static void main(String[] args) {
        // 生成32字节（256位）的随机密钥
        byte[] key = new byte[32];
        new SecureRandom().nextBytes(key);
        
        // 将密钥转换为Base64编码
        String secretKey = Base64.getEncoder().encodeToString(key);
        
        System.out.println("Generated JWT secret key (Base64 encoded):");
        System.out.println(secretKey);
        System.out.println("\nAdd this to your application.yml as:");
        System.out.println("jwt:");
        System.out.println("  secret: " + secretKey);
        System.out.println("\nOr to your application.properties as:");
        System.out.println("jwt.secret=" + secretKey);
    }
}